abstract class Product {
    public abstract void info();
}

class ProductA extends Product {
    @Override
    public void info()
    {
        System.out.println("ProductA");
    }

}

class ProductB extends Product {
    @Override
    public void info()
    {
        System.out.println("ProductB");
    }
}

class Factory {
 
    static Product createProduct(String s)
    {
        Product product = null;
        switch (s) {
            case "A":
                product = new ProductA();
                break;

            case "B":
                product = new ProductB();
                break;

            default:
                System.out.println("No product " + s);
        }
        return product;
    }
}

class test {
    public static void main(String[] args) {
        Product A = Factory.createProduct("A");
        A.info();
        Product B = Factory.createProduct("B");
        B.info();
    }
}